exports.ImageTable = function(jsonObj) {
	var tableString = "<table id='allImagesTable'>";

	var imageCounterId = 0;
	numberColumns = 10
	numberRow = jsonObj.length / numberColumns;

	for(var row = 0; row < numberRow; row++) {
		tableString += "<tr id='column" + row + "'>";
		for(var col = 0; col < numberColumns; col++) {
			if(col + row * numberColumns < jsonObj.length) {
				var image = jsonObj[(col + row * numberColumns)];
				tableString += "<td align='center' id='cellImage" + (col + row * numberColumns) + "'><img class='thumb 'alt='not found'src='http://localhost:3000/public/imageFolder/" + image.name + "' id=image" + (col + row * numberColumns) + "></td>";
				tableString += "<td> description: " + image.description + " <br>"
				tableString += " name: " + image.name + " <br>"
				tableString += " id: " + image.id + " <br>"
				tableString += " date: " + (image.dateCreat.getDate() + 1) + " " + (image.dateCreat.getMonth() + 1)+ " " + image.dateCreat.getFullYear() + " " + " <br>"
				tableString += " url: <a class='singleLink' href='/images/" + image.id +"'> link </a> <br>"
				tableString += " owner:" + image.owner + "</td>"

			}
		}
		tableString += "</tr>";
	}
	tableString += "</table>";

	return tableString;

}

exports.SingleImage = function(image) {
	var tableString = "<table id='singleImgage'>";
	tableString += "<tr>";
	tableString += "<td align='center''><img class='fullThumb' src='http://localhost:3000/public/imageFolder/" + image.name + "' id='image'></td>";
	tableString += "<td> description: " + image.description + " <br>"
	tableString += " id: " + image.id + " <br>"
	tableString += " url: <a href='http://localhost:3000'> return to all view</a><br>"
	tableString += " owner:" + image.owner + "</td>"
	tableString += "</tr>";
	tableString += "</table>";

	return tableString;

}

exports.SameNameImage = function(jsonObj) {
	var tableString = "<table id='sameNameImages'>";

	var imageCounterId = 0;
	numberColumns = 10
	numberRow = jsonObj.length / numberColumns;

	for(var row = 0; row < numberRow; row++) {
		tableString += "<tr id='column" + row + "'>";
		for(var col = 0; col < numberColumns; col++) {
			if(col + row * numberColumns < jsonObj.length) {
				tableString += "<td align='center' id='cellImage" + (col + row * numberColumns) + "'><img class='thumb 'alt='not found'src='http://localhost:3000/public/imageFolder/" + jsonObj[(col + row * numberColumns)].name + "' id=image" + (col + row * numberColumns) + "></td>";
				tableString += "<td> description: " + jsonObj[(col + row * numberColumns)].description + " <br>"
				tableString += " name:" + jsonObj[(col + row * numberColumns)].name + " <br>"
				tableString += " id:" + jsonObj[(col + row * numberColumns)].id + " <br>"
				tableString += " url: <a href='/images/" + jsonObj[(col + row * numberColumns)].id + "'> link</a> <br>"
				tableString += " owner:" + image.owner + "</td>"

			}
		}
		tableString += "</tr>";
	}
	tableString += "</table>";

	return tableString;

}

exports.getLogs = function(jsonObj) {

	var tableString = "<table id='logsTable' style='font-size:13px; '  cellpadding='9'>";

	for(i in jsonObj) {
		tableString += "<tr><td> action:  " + jsonObj[i].action + " <br>";
		tableString += " index: " + jsonObj[i].index + " <br>"
		tableString += " date: " + (jsonObj[i].when.getDate() + 1) + " " + (jsonObj[i].when.getMonth() + 1) + " " + jsonObj[i].when.getFullYear() + "<br>"
		tableString += " user name: " + jsonObj[i].user + " <br></td></tr>"

	}
	tableString += "</table>";
	return tableString;

}